//
//  BVBVMyOrderCell.m
//  BuyVegetable
//
//  Created by zhuzi on 16/10/14.
//  Copyright © 2016年 com.yinding. All rights reserved.
//

#import "BVMyOrderCell.h"

@implementation BVMyOrderCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        
        _orderTimerLabel = [[UILabel alloc]init];
        _orderTimerLabel.text = @"下单日期 2016-09-90 13:144";
        _orderTimerLabel.font = [UIFont systemFontOfSize:14];
        _orderTimerLabel.textColor = [UIColor BVTextGrayColor];
        [self.contentView addSubview:_orderTimerLabel];
        _orderTimerLabel.sd_layout.topSpaceToView(self.contentView,0).leftSpaceToView(self.contentView,10).rightSpaceToView(self.contentView,0).heightIs(25);
        
        UIView * lineView = [[UIView alloc]init];
        lineView.backgroundColor = [UIColor BVLineGrayColor];
        [self.contentView addSubview:lineView];
        lineView.sd_layout.topSpaceToView(_orderTimerLabel,0).leftSpaceToView(self.contentView,10).rightSpaceToView(self.contentView,10).heightIs(0.5);
        
        _money = [[UILabel alloc]init];
        _money.text = @"订单金额：7.2元";
        _money.font = [UIFont systemFontOfSize:14];
        _money.textColor = [UIColor BVTextGrayColor];
        _money.textAlignment = NSTextAlignmentRight;
        [self.contentView addSubview:_money];
        _money.sd_layout.bottomSpaceToView(self.contentView,0).leftSpaceToView(self.contentView,0).rightSpaceToView(self.contentView,10).heightIs(25);
        
        UIView * lineView2 = [[UIView alloc]init];
        lineView2.backgroundColor = [UIColor BVLineGrayColor];
        [self.contentView addSubview:lineView2];
        lineView2.sd_layout.bottomSpaceToView(_money,0).leftSpaceToView(self.contentView,10).rightSpaceToView(self.contentView,10).heightIs(0.5);
        
        //图片
        _img = [[UIImageView alloc]init];
        _img.backgroundColor = [UIColor redColor];
        _img.image = [UIImage imageNamed:@"vipcenter"];
        [self.contentView addSubview:_img];
        _img.sd_layout.topSpaceToView(lineView,1).leftSpaceToView(self.contentView,10).bottomSpaceToView(lineView2,1).widthIs(80);
        
        _titelLabel = [[UILabel alloc]init];
        _titelLabel.text = @"西红柿 （普通*促销）";
        _titelLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:15];
        _titelLabel.textColor = [UIColor BVBaseTextBlackColor];
        [self.contentView addSubview:_titelLabel];
        _titelLabel.sd_layout.topSpaceToView(_orderTimerLabel,0).leftSpaceToView(_img,10).rightSpaceToView(self.contentView,0).heightIs(30);
        
        _priceLabel = [[UILabel alloc]init];
        _priceLabel.text = @"7.2元每袋";
        _priceLabel.font = [UIFont systemFontOfSize:14];
        _priceLabel.textColor = [UIColor BVTextGrayColor];
        _priceLabel.lineBreakMode = NSLineBreakByTruncatingTail;
        CGSize maximumLabelSize = CGSizeMake(100, 9999);//labelsize的最大值
        CGSize expectSize = [_priceLabel sizeThatFits:maximumLabelSize];
        [self.contentView addSubview:_priceLabel];
        _priceLabel.sd_layout.topSpaceToView(_titelLabel,0).leftSpaceToView(_img,10).heightIs(30).widthIs(expectSize.width);
        
        _priceDetailLabel = [[UILabel alloc]init];
        _priceDetailLabel.text = @"10斤装";
        _priceDetailLabel.font = [UIFont systemFontOfSize:14];
        _priceDetailLabel.textColor = [UIColor BVBaseOrangeColor];
        _priceDetailLabel.lineBreakMode = NSLineBreakByTruncatingTail;
        [self.contentView addSubview:_priceDetailLabel];
        _priceDetailLabel.sd_layout.topSpaceToView(_titelLabel,0).leftSpaceToView(_priceLabel,10).rightSpaceToView(self.contentView,0).heightIs(30);
        
        
    }
    
    return self;
}

@end
